		<style>
		.sendtype-tip {padding: 0.5rem 0rem; background: #fdf5e9;font-size:0.65rem;padding:0.3rem;text-align:center;}
		</style>
		<div id="carrierTab" class="fui-tab fui-tab-danger" style="margin-bottom: 0">
            <a ng-repeat="(k,s) in pagedata.sendtypes" ng-class="{'active':pagedata.post.sendtype==k}" ng-click="pagedata.post.sendtype=k;pagedata.cart_refresh()">{{s}}</a>
        </div>
		<div ng-if="pagedata.sendtypes.length>1" class="sendtype-tip">选择<red>{{pagedata.goodsname||'水果'}}</red>成熟后，领取<red>{{pagedata.goodsname||'水果'}}</red>的方式</div>
		<div ng-if="pagedata.sendtypes.length==1" class="sendtype-tip">目前只支持，<red>{{pagedata.goodsname||'水果'}}</red>成熟后，《{{pagedata.sendtypes[0] || pagedata.sendtypes[1]}}》领取<red>{{pagedata.goodsname||'水果'}}</red></div>
		<div ng-if="!pagedata.sendtypes || pagedata.sendtypes.length==0" class="sendtype-tip">目前不支持任何，<red>{{pagedata.goodsname||'水果'}}</red>成熟后，领取<red>{{pagedata.goodsname||'水果'}}</red>的方式</div>
		<!--地址选择-->
		<div id="addressInfo" ng-show="pagedata.post.sendtype==1" class="fui-cell-group fui-address-group" style="margin-top:0px">
			<div ng-if="pagedata.post.addressid" class="fui-cell" ng-click="pagedata.get_addresslist()">
				<div style="width:100%">
					<div class="fui-cell-text name bold" style="font-size:0.8rem">
						<span style="margin-right:20px">{{pagedata.post.address.name}}</span><span>{{pagedata.post.address.mobile}}</span>
					</div>
					<div class="fui-cell-text name" style="margin-top:5px">	
						<i class="fui-tag fui-tag-red">默认</i>
						<i class="fui-tag fui-tag-blue">家</i>
						{{pagedata.post.address.pcd.province||''}} {{pagedata.post.address.pcd.city ||''}} {{pagedata.post.address.pcd.district||''}} {{pagedata.post.address.address ||''}}
					</div>
				</div>
				<div class="fui-cell-remark"></div>
			</div>
			<div ng-if="!pagedata.post.addressid" class="fui-cell">
				<div class="fui-list-inner" ng-click="pagedata.edit_address=1">
						<div class="text no-address" ><i class="icon jinyunicon icon-tianjia"></i>添加收货地址</div>
				</div>
			</div>
		</div>
<!--自提点选择-->
    <div ng-show="pagedata.post.sendtype==0">
		<div class="fui-list-group"  id="carrierInfo" style="margin: 0 0 0.5rem">
			<a class="fui-list" href="javascript:;" onclick="$('#showstores').modal();">
						<div class="fui-list-media">
							<i class="icon icon-map"></i>
						</div>
						<div class="fui-list-inner">
							<div class="subtitle" >
								<span style="overflow: hidden;display: inline-block;">{{pagedata.selectstore.title}}</span>
								<span class='realname'>({{pagedata.selectstore.mobile || '无'}})</span>								
							</div>
							<div class="text address">地址：<span style="color:red">{{pagedata.selectstore.pcd.city}}</span>({{pagedata.selectstore.pcd.district}} {{pagedata.selectstore.pcd.street}} {{pagedata.selectstore.address}})</div>
						</div>
						<div class="fui-list-angle">
							<div class="angle"></div>
						</div>
			</a>
		</div>
	</div>
<div id="showstores"  class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
	<div class="modal-dialog" style="width:100%;left:0;bottom:0">
		<div class="modal-bottom">
			<div ng-include="sys_html('_stores')"></div>
		</div>
	</div>
</div>
<div ng-if="pagedata.modal_address==1" class="popup">
	<div class="popup-body">
		<div class="popup-bottom" style="padding-bottom:2.5rem">
		<i class="closed icon icon-close" style="color:red;top:0.3rem" ng-click="pagedata.modal_address=0"></i>
		<div class="fui-list-group modal-swiper-y" style='margin-top:5px;background:#fff'>
			<div class="fui-list address-item" ng-repeat="item in pagedata.address_list">				
				<div class="fui-list-inner">
					<div class="title" ng-click="pagedata.change_address(item)"><span class='realname'>{{item.name}}</span> <span class='mobile'>{{item.mobile}}</span></div>
					<div class="text" ng-click="pagedata.change_address(item)"><span class='address'>{{item.province}} {{item.city}} {{item.district}} {{item.address}}</span></div>
					<div class='bar' style="line-height:1.4">
						<span class='pull-right'>
							<a class="external" href="javascript:;" ng-click="pagedata.edit_address=1;pagedata.item.address=item;pagedata.isaddaddress=0">
							<i class='icon icon-bianji'></i> 编辑
							</a>
							<a class='external' href="javascript:;" ng-click="pagedata.del_address($index)">
							<i class='icon icon-shanchu'></i> 删除
							</a>
						</span>
						<label class='radio-inline'  ng-click="pagedata.setaddress($index);pagedata.change_address(item)">
							<input type="radio" class="fui-radio  fui-radio-danger" ng-checked="item.isdefault==1"/> 设置默认
						</label>
					</div>
				</div>
			</div>
		</div>
		<div class='fui-navbar'>
			<a class="nav-item btn btn-danger external" ng-click="pagedata.edit_address=1;pagedata.item.address.address='';pagedata.isaddaddress=1"><i class="icon icon-tianjia" style="font-size:32rpx"></i> 添加地址</a>
		</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.edit_address==1" class="popup">
	<div class="popup-body">
		<div class="popup-center">
			<div class='fui-cell-group modal-swiper-y'>
				<div class="fui-cell">
					<div class="fui-cell-label" style="width:100px;font-size:0.9rem">添加地址</div>
					<div class='fui-cell-info'></div>
					<div class="fui-cell-remark" ng-if="pagedata.openid && pagedata.isaddaddress==1"><span ng-click="pagedata.openAddress()">添加微信地址</span></div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>收件人</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.post.address.name" placeholder="收件人" class="fui-input"/></div>
                </div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>联系电话</div>
                    <div class='fui-cell-info'><input type="tel" ng-model="pagedata.post.address.mobile" placeholder="联系电话"  class="fui-input"/></div>
                </div>
                <div class="fui-cell">
					<div class="fui-cell-label ">地区</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.post.address.pcd.province" class="form-control tpl-province">
						<option value="" selected="selected">省份</option>
						<option ng-repeat="(value,data) in pagedata.province" value="{{value}}" ng-selected="pagedata.post.address.pcd.province==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.post.address.pcd.city" class="form-control tpl-city">
						<option value="" selected="selected">城市</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.post.address.pcd.province]" value="{{value}}" ng-selected="pagedata.post.address.pcd.city==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.post.address.pcd.district" class="form-control tpl-district">
						<option value="" selected="selected">区县</option>
						<option ng-repeat="(value,data) in pagedata.province[pagedata.post.address.pcd.province][pagedata.post.address.pcd.city]" value="{{value}}" ng-selected="pagedata.post.address.pcd.district==value">{{value}}</option>
						</select>
					</div>
					<div class="fui-cell-label" style="width:28%">
						<select ng-model="pagedata.post.address.pcd.street" class="form-control tpl-district">
						<option value="" selected="selected">街道</option>
						<option ng-repeat="value in pagedata.province[pagedata.post.address.pcd.province][pagedata.post.address.pcd.city][pagedata.post.address.pcd.district]" value="{{value}}" ng-selected="pagedata.post.address.pcd.street==value">{{value}}</option>
						</select>
					</div>
				</div>
                <div class='fui-cell'>
                    <div class='fui-cell-label'>详细地址</div>
                    <div class='fui-cell-info'><input type="text" ng-model="pagedata.post.address.address" placeholder='街道，楼牌号等'  class="fui-input"/></div>
                </div>
            </div>
			<div class="fui-navbar">
				<a href="javascript:;" ng-click="pagedata.add_address();" class="nav-item btn btn-danger confirmbtn">确定</a>
			</div>
			<i ng-click="pagedata.edit_address=0" class="closed icon icon-cuowu"></i>
		</div>
	</div>
</div>
<script>
scope.pagedata.setaddress=function(index){
	var id =scope.pagedata.address_list[index].id
	scope.get('core/member.address/set/id='+id+'&get=1',function(res){
		for(var i in scope.pagedata.address_list){
				scope.pagedata.address_list[i].isdefault=0
		}
		scope.pagedata.address_list[index].isdefault=1
		scope.pagedata.post.addressid=id
		scope.pagedata.modal_address=0;
		scope.message('设置成功');
		scope.$evalAsync();
	});
}
scope.pagedata.del_address=function(index){
	var id =scope.pagedata.address_list[index].id
	scope.get('core/member.address/del/id='+id+'&get=1',function(res){
		scope.pagedata.address_list.splice(index,1);
		scope.message('删除成功');
		scope.$evalAsync();
	});
}
scope.pagedata.get_addresslist=function(){
	scope.pagedata.post.address.res=1
	scope.get('core/member.address/',function(res){
		scope.pagedata.address_list=res.list;
		scope.pagedata.modal_address=1;
		scope.$evalAsync();	
	});
}
scope.pagedata.add_address=function(){
	scope.pagedata.post.address.res=1
	if(scope.pagedata.isaddaddress==1){
		scope.pagedata.post.address.id=0;
	}
	scope.post_json('core/member.address/post/',scope.pagedata.post.address,function(res){
			console.log(res);
			scope.pagedata.post.addressid =res;
			scope.get('jy_farmer/get_data/get_freight/showbaoyou=1&addressid='+res+'&total='+scope.pagedata.post.total,function(freight){
				console.log(freight);
				scope.pagedata.post.endprice=parseFloat(scope.pagedata.post.endprice)-parseFloat(scope.pagedata.post.dispatchprice)+parseFloat(freight.fee);
				scope.pagedata.post.dispatchprice=freight.fee;
				scope.pagedata.post.peisongfee=scope.pagedata.post.dispatchprice
				scope.pagedata.post.addbaoyoufee=freight.addbaoyoufee;
				scope.pagedata.post.isonebaoyou=freight.isonebaoyou;
				scope.pagedata.edit_address=0;
				scope.pagedata.modal_address=0;
				scope.pagedata.post.outarea=freight.outarea;
				scope.pagedata.post.no_out_price=freight.no_out_price?freight.no_out_price:0;
				scope.pagedata.post.baoyou_man=freight.baoyou_man?freight.baoyou_man:0;
				scope.pagedata.post.peisong_juli=freight.juli?freight.juli:scope.pagedata.post.peisong_juli;
				scope.pagedata.cart_refresh();
				scope.$evalAsync();
			});
	});
}
scope.pagedata.change_address=function(res){
	console.log(res);
	scope.pagedata.post.address=res;
	scope.pagedata.post.addressid=res.id;
	scope.get('jy_farmer/get_data/get_freight/showbaoyou=1&addressid='+res.id+'&total='+scope.pagedata.post.total,function(freight){
		console.log('change_address');console.log(freight);
		scope.pagedata.post.endprice=parseFloat(scope.pagedata.post.endprice)-parseFloat(scope.pagedata.post.dispatchprice)+parseFloat(freight.fee);
		scope.pagedata.post.dispatchprice=freight.fee;
		scope.pagedata.post.peisongfee=scope.pagedata.post.dispatchprice
		scope.pagedata.post.addbaoyoufee=freight.addbaoyoufee;
		scope.pagedata.post.isonebaoyou=freight.isonebaoyou;
		scope.pagedata.modal_address=0;
		scope.pagedata.post.outarea=freight.outarea;
		scope.pagedata.post.no_out_price=freight.no_out_price?freight.no_out_price:0;
		scope.pagedata.post.baoyou_man=freight.baoyou_man?freight.baoyou_man:0;
		scope.pagedata.post.peisong_juli=freight.juli?freight.juli:scope.pagedata.post.peisong_juli;
		scope.pagedata.cart_refresh();
		scope.$evalAsync();
				
	});	
}
scope.pagedata.getprovince=function(){
	scope.get('core/member.set/getprovince/',function(res){
		scope.pagedata.province=res.province;
		scope.$evalAsync();
	});
}
scope.pagedata.getprovince();
</script>